﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Curchy.MetablogCMS
{
    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("metablog/api");

            routes.MapRoute(
                "Metablog",
                "metablog/{action}",
                new { controller = "metablog" }
            );

            routes.MapRoute(
                "MetablogAction",
                "metablog/{action}/{uid}",
                new { controller = "Metablog" }
            );

            routes.MapRoute(
                "Page",
                "{*slug}",
                new { controller = "Page", action = "View" }
            );

        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);
        }
    }
}